{template header}
<style>
.sHistory {behavior:url(#default#savehistory);}
</style>
<div class="cru">
	<a href="{SITE_URL}">{$setting['site_name']}</a>
	<!--{loop $navlist $nav}-->
		 &gt;&gt; <a href="{url category/view/$nav['id']}">{$nav['name']}</a>  
	<!--{/loop}-->	
</div>

<div class="listBody">
	<div class="block">
    	<div class="title"><h3>&nbsp;投票中</h3></div>
        <div class="question">
        	<div class="head">
                <h5>{$question['title']}</h5>
                <div class="operaBtns">
					<div>
						<ul>
						<li><a href="javascript:window.open('http://share.renren.com/share/buttonshare.do?title='+encodeURIComponent(document.title.substring(0,76))+'&link='+encodeURIComponent(location.href)+'&content=','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0" style="color:#000000;text-decoration:none;font-size:12px;font-weight:normal"><SPAN style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 1px; CURSOR: pointer; PADDING-TOP: 0px"><IMG alt=人人网 src="http://s.xnimg.cn/favicon-rr.ico" align=absMiddle border=0>&nbsp;人人网</SPAN></a> </li>
						<li><a href="javascript:window.open('http://v.t.sina.com.cn/share/share.php?title='+encodeURIComponent(document.title.substring(0,76))+'&url='+encodeURIComponent(location.href)+'&rcontent=','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0" style="color:#000000;text-decoration:none;font-size:12px;font-weight:normal"><SPAN style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 1px; CURSOR: pointer; PADDING-TOP: 0px"><IMG alt=新浪微博 src="http://t.sina.com.cn/favicon.ico" align=absMiddle border=0>&nbsp;新浪微博</SPAN></a></li>
						<li><a href="javascript:window.open('http://www.kaixin001.com/repaste/share.php?rtitle='+encodeURIComponent(document.title.substring(0,76))+'&rurl='+encodeURIComponent(location.href)+'&rcontent=','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0" style="color:#000000;text-decoration:none;font-size:12px;font-weight:normal"><SPAN style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 12px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 1px; CURSOR: pointer; PADDING-TOP: 0px"><IMG alt=开心网 src="http://img1.kaixin001.com.cn/i/favicon.ico" align=absMiddle border=0>&nbsp;开心网</SPAN></a></li>
						<li>分享到：</li>
						</ul>
					</div>
                </div>
            </div>
            <div class="cont">{$question['description']}</div>
            <div class="askInfo">
            	提问者:	<!--{if $question['hidden']}-->匿名<!--{else}--><a href="{url user/space/$question['authorid']}" target="_blank">{$question['author']}</a><!--{/if}-->&nbsp;&nbsp;
            	悬赏分:<span class="score">{$question['price']}分</span>
            	提问时间:{$asktime}&nbsp;
            	距离结束:<font id="LiveClock1">{$endtime}</font>
            </div>
            <!--{if $supplylist}-->
            <div class="questionSupply">
            	<h5>对问题的补充</h5>
            	<!--{loop $supplylist $supply}-->
            	<div>{$supply['content']}</div>
            	<p>补充时间:{$supply['format_time']}</p>
            	<!--{/loop}-->
            </div>
			<!--{/if}-->
		</div>
          <!--{if $ad}-->
          <div id="ad" class="adv">
          <p>{$ad['code']}</p>
          </div>
          <!--{/if}-->
    </div>
 	<!--{if $solvelist}-->
	<div class="block">
    	<div class="title">
        	<h3>相关内容</h3>
        </div>
		<div class="questionList">
			<div id="solved_topic_panel">
				<ul>
						<!--{loop $solvelist $question1}-->
						<li>
							<h6><a href="{$question1['url']}" target="_blank">{$question1['title']}</a></h6>
							<span>[<a href="{url category/view/$question1['cid']}">{$question1['category_name']}</a>] </span>
						</li>
					<!--{/loop}-->
				</ul>
			</div>
		</div>
   </div>
   	<!--{/if}-->
	<!--{if $question['answers']>1}-->
	<div class="block">
    	<div class="title">
        	<h3>投票备选答案<small>共{$question['answers']}条</small></h3>
        </div>
        <!--{loop $answerlist $answer}-->
		     	<div class="question otherAsw">
		     		<div class="head">
			     		<div class="aswInfo">
							回答人：<a target="_blank" href="{url user/space/$answer['authorid']}">{$answer['author']}</a>&nbsp;
							时间：{$answer['time']}
						</div>
						<div class="operaBtns"><ul><li><input type="button"  value="投他一票" name="submit" onclick="myvote({$answer['qid']},{$answer['id']});"/></li></ul></div>
			  		</div>
			   		<div class="cont">{$answer['content']}</div>
			   		</div>
	   <!--{/loop}-->
		     	<div class="question otherAsw">
		     		<div class="head"><div class="cont"><a href="javascript:myresult();">查看投票结果</a></div>
			   </div>
   </div>
   <!--{/if}-->
</div>
</div>
<script type="text/javascript">

function myvote(qid,aid){
   if(0==g_user.uid){
  	 alert('登录后才可以投票！');
	 return;
   }
	$.ajax({
	   type: "post",
	   url: "index.php?c=question&a=ajaxvote",
	   data: "qid="+qid+"&aid="+aid,
	   success: function(msg){
	     if(1==msg){
	     	myresult();
	     }else{
	     	alert('您已经投过票！');
	     }
	   }
	}); 
}

function myresult(){
	var votestring='';
	$.getJSON("{url question/ajaxviewvote/$question['id']}", function(json){
		$.each( json, function(i, answer){
			votestring+='<tr><td class="f14" nowrap="nowrap" height="20" width="23%">'+answer.author+'：</td><td class="f14" width="77%"><img src="{SITE_URL}css/default/bar1.gif" height="10" width="'+answer.votes+'">'+answer.votes+'票</td></tr>';
		}); 
		$.dialog({
		    id:'voteDiv',
		    position:'center',
		    align:'left',
		    fixed:1,
		    width:300,
		     height:100,
		    title:'投票提示',
		    okText:'关闭窗口',
		    fnOk:function(){$.dialog.close('voteDiv');},
		    content:'<p class="f14b tl">感谢您的参与！</p></div><div class="f14b">当前投票结果： </div><table class="mb10" border="0" cellpadding="0" cellspacing="0"><tbody>'+votestring+'</tbody></table>' });
		}); 
}
</script>
{template footer}